import{s as et,n as at,o as st}from"../chunks/scheduler.d6170356.js";import{S as nt,i as lt,g as p,s as n,r as g,A as it,h as d,f as a,c as l,j as O,u as T,x as w,k as tt,y as pt,a as s,v as G,d as _,t as k,w as F}from"../chunks/index.fcd4cc08.js";import{C as E}from"../chunks/CodeBlock.7b16bdef.js";import{H as dt,E as rt}from"../chunks/EditOnGithub.da2b595c.js";function ot(L){let i,b,R,Y,r,j,o,P=`<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="/docs/huggingface_hub/guides/hf_file_system#integrations"><code>hf://</code></a>) to read and write data on the Hub:`,B,u,x='First you need to <a href="/docs/huggingface_hub/quick-start#login">Login with your Hugging Face account</a>, for example using:',U,m,q,h,S='Then you can <a href="/docs/huggingface_hub/quick-start#create-a-repository">Create a dataset repository</a>, for example using:',V,c,v,f,A='Finally, you can use <a href="/docs/huggingface_hub/guides/hf_file_system#integrations">Hugging Face paths</a> in Pandas:',I,y,W,J,K=`This creates a dataset repository <code>username/my_dataset</code> containing your Pandas dataset in Parquet format.
You can reload it later:`,H,M,C,Z,D='To have more information on the Hugging Face paths and how they are implemented, please refer to the <a href="/docs/huggingface_hub/guides/hf_file_system">the client library’s documentation on the HfFileSystem</a>.',Q,X,z,$,N;return r=new dt({props:{title:"Pandas",local:"pandas",headingTag:"h1"}}),m=new E({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login',wrap:!1}}),c=new E({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 E({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 E({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}}),X=new rt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-pandas.md"}}),{c(){i=p("meta"),b=n(),R=p("p"),Y=n(),g(r.$$.fragment),j=n(),o=p("p"),o.innerHTML=P,B=n(),u=p("p"),u.innerHTML=x,U=n(),g(m.$$.fragment),q=n(),h=p("p"),h.innerHTML=S,V=n(),g(c.$$.fragment),v=n(),f=p("p"),f.innerHTML=A,I=n(),g(y.$$.fragment),W=n(),J=p("p"),J.innerHTML=K,H=n(),g(M.$$.fragment),C=n(),Z=p("p"),Z.innerHTML=D,Q=n(),g(X.$$.fragment),z=n(),$=p("p"),this.h()},l(t){const e=it("svelte-u9bgzb",document.head);i=d(e,"META",{name:!0,content:!0}),e.forEach(a),b=l(t),R=d(t,"P",{}),O(R).forEach(a),Y=l(t),T(r.$$.fragment,t),j=l(t),o=d(t,"P",{"data-svelte-h":!0}),w(o)!=="svelte-59ecvr"&&(o.innerHTML=P),B=l(t),u=d(t,"P",{"data-svelte-h":!0}),w(u)!=="svelte-1jdzygp"&&(u.innerHTML=x),U=l(t),T(m.$$.fragment,t),q=l(t),h=d(t,"P",{"data-svelte-h":!0}),w(h)!=="svelte-wfb25d"&&(h.innerHTML=S),V=l(t),T(c.$$.fragment,t),v=l(t),f=d(t,"P",{"data-svelte-h":!0}),w(f)!=="svelte-1j7afyv"&&(f.innerHTML=A),I=l(t),T(y.$$.fragment,t),W=l(t),J=d(t,"P",{"data-svelte-h":!0}),w(J)!=="svelte-19lewo4"&&(J.innerHTML=K),H=l(t),T(M.$$.fragment,t),C=l(t),Z=d(t,"P",{"data-svelte-h":!0}),w(Z)!=="svelte-pgv1l5"&&(Z.innerHTML=D),Q=l(t),T(X.$$.fragment,t),z=l(t),$=d(t,"P",{}),O($).forEach(a),this.h()},h(){tt(i,"name","hf:doc:metadata"),tt(i,"content",ut)},m(t,e){pt(document.head,i),s(t,b,e),s(t,R,e),s(t,Y,e),G(r,t,e),s(t,j,e),s(t,o,e),s(t,B,e),s(t,u,e),s(t,U,e),G(m,t,e),s(t,q,e),s(t,h,e),s(t,V,e),G(c,t,e),s(t,v,e),s(t,f,e),s(t,I,e),G(y,t,e),s(t,W,e),s(t,J,e),s(t,H,e),G(M,t,e),s(t,C,e),s(t,Z,e),s(t,Q,e),G(X,t,e),s(t,z,e),s(t,$,e),N=!0},p:at,i(t){N||(_(r.$$.fragment,t),_(m.$$.fragment,t),_(c.$$.fragment,t),_(y.$$.fragment,t),_(M.$$.fragment,t),_(X.$$.fragment,t),N=!0)},o(t){k(r.$$.fragment,t),k(m.$$.fragment,t),k(c.$$.fragment,t),k(y.$$.fragment,t),k(M.$$.fragment,t),k(X.$$.fragment,t),N=!1},d(t){t&&(a(b),a(R),a(Y),a(j),a(o),a(B),a(u),a(U),a(q),a(h),a(V),a(v),a(f),a(I),a(W),a(J),a(H),a(C),a(Z),a(Q),a(z),a($)),a(i),F(r,t),F(m,t),F(c,t),F(y,t),F(M,t),F(X,t)}}}const ut='{"title":"Pandas","local":"pandas","sections":[],"depth":1}';function mt(L){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jt extends nt{constructor(i){super(),lt(this,i,mt,ot,et,{})}}export{Jt as component};
