import{s as O,n as tt,o as et}from"../chunks/scheduler.d6170356.js";import{S as at,i as st,g as p,s as l,r as w,A as lt,h as r,f as a,c as n,j as K,u as G,x as g,k as D,y as nt,a as s,v as _,d as k,t as F,w as R}from"../chunks/index.fcd4cc08.js";import{C as z}from"../chunks/CodeBlock.7b16bdef.js";import{H as it}from"../chunks/Heading.8660bd0e.js";function pt(N){let i,Y,X,b,d,j,o,L=`<a href="https://github.com/pandas-dev/pandas" rel="nofollow">Pandas</a> is a widely used Python data analysis toolkit.
Since it uses <a href="https://filesystem-spec.readthedocs.io" rel="nofollow">fsspec</a> to read and write remote data, you can use the Hugging Face paths (<a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow"><code>hf://</code></a>) to read and write data on the Hub:`,B,h,E='First you need to <a href="../huggingface_hub/quick-start#login">Login with your Hugging Face account</a>, for example using:',U,u,$,c,P='Then you can <a href="../huggingface_hub/quick-start#create-a-repository">Create a dataset repository</a>, for example using:',q,m,V,f,x='Finally, you can use [Hugging Face paths](<a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow">Hugging Face paths</a>) in Pandas:',I,y,W,J,S=`This creates a dataset repository <code>username/my_dataset</code> containing your Pandas dataset in Parquet format.
You can reload it later:`,H,M,v,Z,A='To have more information on the Hugging Face paths and how they are implemented, please refer to the <a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system" rel="nofollow">the client library’s documentation on the HfFileSystem</a>.',C,T,Q;return d=new it({props:{title:"Pandas",local:"pandas",headingTag:"h1"}}),u=new z({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login',wrap:!1}}),m=new z({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBJTBBSGZBcGkoKS5jcmVhdGVfcmVwbyhyZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZteV9kYXRhc2V0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMik=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi

HfApi().create_repo(repo_id=<span class="hljs-string">&quot;username/my_dataset&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>)`,wrap:!1}}),y=new z({props:{code:"aW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQWRmLnRvX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRmRhdGEucGFycXVldCUyMiklMEElMEElMjMlMjBvciUyMHdyaXRlJTIwaW4lMjBzZXBhcmF0ZSUyMGZpbGVzJTIwaWYlMjB0aGUlMjBkYXRhc2V0JTIwaGFzJTIwdHJhaW4lMkZ2YWxpZGF0aW9uJTJGdGVzdCUyMHNwbGl0cyUwQWRmX3RyYWluLnRvX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnRyYWluLnBhcnF1ZXQlMjIpJTBBZGZfdmFsaWQudG9fcGFycXVldCglMjJoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGdmFsaWRhdGlvbi5wYXJxdWV0JTIyKSUwQWRmX3Rlc3QlMjAudG9fcGFycXVldCglMjJoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGdGVzdC5wYXJxdWV0JTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/data.parquet&quot;</span>)

<span class="hljs-comment"># or write in separate files if the dataset has train/validation/test splits</span>
df_train.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/train.parquet&quot;</span>)
df_valid.to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/validation.parquet&quot;</span>)
df_test .to_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/test.parquet&quot;</span>)`,wrap:!1}}),M=new z({props:{code:"aW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQWRmJTIwJTNEJTIwcGQucmVhZF9wYXJxdWV0KCUyMmhmJTNBJTJGJTJGZGF0YXNldHMlMkZ1c2VybmFtZSUyRm15X2RhdGFzZXQlMkZkYXRhLnBhcnF1ZXQlMjIpJTBBJTBBJTIzJTIwb3IlMjByZWFkJTIwZnJvbSUyMHNlcGFyYXRlJTIwZmlsZXMlMjBpZiUyMHRoZSUyMGRhdGFzZXQlMjBoYXMlMjB0cmFpbiUyRnZhbGlkYXRpb24lMkZ0ZXN0JTIwc3BsaXRzJTBBZGZfdHJhaW4lMjAlM0QlMjBwZC5yZWFkX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnRyYWluLnBhcnF1ZXQlMjIpJTBBZGZfdmFsaWQlMjAlM0QlMjBwZC5yZWFkX3BhcnF1ZXQoJTIyaGYlM0ElMkYlMkZkYXRhc2V0cyUyRnVzZXJuYW1lJTJGbXlfZGF0YXNldCUyRnZhbGlkYXRpb24ucGFycXVldCUyMiklMEFkZl90ZXN0JTIwJTIwJTNEJTIwcGQucmVhZF9wYXJxdWV0KCUyMmhmJTNBJTJGJTJGZGF0YXNldHMlMkZ1c2VybmFtZSUyRm15X2RhdGFzZXQlMkZ0ZXN0LnBhcnF1ZXQlMjIp",highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/data.parquet&quot;</span>)

<span class="hljs-comment"># or read from separate files if the dataset has train/validation/test splits</span>
df_train = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/train.parquet&quot;</span>)
df_valid = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/validation.parquet&quot;</span>)
df_test  = pd.read_parquet(<span class="hljs-string">&quot;hf://datasets/username/my_dataset/test.parquet&quot;</span>)`,wrap:!1}}),{c(){i=p("meta"),Y=l(),X=p("p"),b=l(),w(d.$$.fragment),j=l(),o=p("p"),o.innerHTML=L,B=l(),h=p("p"),h.innerHTML=E,U=l(),w(u.$$.fragment),$=l(),c=p("p"),c.innerHTML=P,q=l(),w(m.$$.fragment),V=l(),f=p("p"),f.innerHTML=x,I=l(),w(y.$$.fragment),W=l(),J=p("p"),J.innerHTML=S,H=l(),w(M.$$.fragment),v=l(),Z=p("p"),Z.innerHTML=A,C=l(),T=p("p"),this.h()},l(t){const e=lt("svelte-u9bgzb",document.head);i=r(e,"META",{name:!0,content:!0}),e.forEach(a),Y=n(t),X=r(t,"P",{}),K(X).forEach(a),b=n(t),G(d.$$.fragment,t),j=n(t),o=r(t,"P",{"data-svelte-h":!0}),g(o)!=="svelte-jc90ym"&&(o.innerHTML=L),B=n(t),h=r(t,"P",{"data-svelte-h":!0}),g(h)!=="svelte-1hbzj8b"&&(h.innerHTML=E),U=n(t),G(u.$$.fragment,t),$=n(t),c=r(t,"P",{"data-svelte-h":!0}),g(c)!=="svelte-1tu70ef"&&(c.innerHTML=P),q=n(t),G(m.$$.fragment,t),V=n(t),f=r(t,"P",{"data-svelte-h":!0}),g(f)!=="svelte-1yg52bd"&&(f.innerHTML=x),I=n(t),G(y.$$.fragment,t),W=n(t),J=r(t,"P",{"data-svelte-h":!0}),g(J)!=="svelte-19lewo4"&&(J.innerHTML=S),H=n(t),G(M.$$.fragment,t),v=n(t),Z=r(t,"P",{"data-svelte-h":!0}),g(Z)!=="svelte-1o8dsbk"&&(Z.innerHTML=A),C=n(t),T=r(t,"P",{}),K(T).forEach(a),this.h()},h(){D(i,"name","hf:doc:metadata"),D(i,"content",rt)},m(t,e){nt(document.head,i),s(t,Y,e),s(t,X,e),s(t,b,e),_(d,t,e),s(t,j,e),s(t,o,e),s(t,B,e),s(t,h,e),s(t,U,e),_(u,t,e),s(t,$,e),s(t,c,e),s(t,q,e),_(m,t,e),s(t,V,e),s(t,f,e),s(t,I,e),_(y,t,e),s(t,W,e),s(t,J,e),s(t,H,e),_(M,t,e),s(t,v,e),s(t,Z,e),s(t,C,e),s(t,T,e),Q=!0},p:tt,i(t){Q||(k(d.$$.fragment,t),k(u.$$.fragment,t),k(m.$$.fragment,t),k(y.$$.fragment,t),k(M.$$.fragment,t),Q=!0)},o(t){F(d.$$.fragment,t),F(u.$$.fragment,t),F(m.$$.fragment,t),F(y.$$.fragment,t),F(M.$$.fragment,t),Q=!1},d(t){t&&(a(Y),a(X),a(b),a(j),a(o),a(B),a(h),a(U),a($),a(c),a(q),a(V),a(f),a(I),a(W),a(J),a(H),a(v),a(Z),a(C),a(T)),a(i),R(d,t),R(u,t),R(m,t),R(y,t),R(M,t)}}}const rt='{"title":"Pandas","local":"pandas","sections":[],"depth":1}';function dt(N){return et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mt extends at{constructor(i){super(),st(this,i,dt,pt,O,{})}}export{mt as component};
